import {
	createRouter,
	createWebHistory,
	createWebHashHistory
} from 'vue-router'
import login from '../view/index/login.vue'
import index from '../view/index/index.vue'
import cashier from '../view/index/cashier.vue'//收银
import order from '../view/index/order.vue' //订单
import returnUrl from '../view/index/returnUrl.vue' //交班
import userShow from '../view/index/userShow.vue' //交班


const router = createRouter({
	history: createWebHashHistory(),
	routes: [{
		path: '/',
		component: index,
		redirect: '/cashier',
		children: [
			{
				path: '/cashier',
				component: cashier,
				meta: {
					title: '收银',
				}
			}, {
				path: '/order',
				component: order,
				children: [
					{
						path: '/order/complete',
						component: () => import('../view/order/complete/index.vue'),
						name: 'CompleteOrder',
						meta: {
							title: '已完成订单',
						}
					},
					{
						path: '/order/wait',
						component: () => import('../view/order/wait/index.vue'),
						name: 'WaitOrder',
						meta: {
							title: '待付款订单',
						}
					},
					{
						path: '/order/exit/whole',
						component: () => import('../view/order/exit/whole/index.vue'),
						name: 'ExitWholeOrder',
						meta: {
							title: '整单退款',
						}
					},
					{
						path: '/order/exit/part',
						component: () => import('../view/order/exit/part/index.vue'),
						name: 'ExitPartOrder',
						meta: {
							title: '部分退款',
						}
					}
				],
			}, {
				path: '/returnUrl',
				component: returnUrl,
				meta: {
					title: '交班',
				}
			}
		]
	}, {
		path: '/login',
		component: login,
		meta: {
			title: '登录',
		}
	}, {
		path: '/userShow',
		component: userShow,
		meta: {
			title: '用户列表',
		}
	}]
})
export default router;